using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication2.Models.Mapping
{
    public class so_ManBatchDetMap : EntityTypeConfiguration<so_ManBatchDet>
    {
        public so_ManBatchDetMap()
        {
            // Primary Key
            this.HasKey(t => new { t.DATE, t.sumfields, t.dimfields });

            // Properties
            this.Property(t => t.BATCH)
                .HasMaxLength(8);

            this.Property(t => t.Transaction_Description)
                .HasMaxLength(130);

            this.Property(t => t.Classfication)
                .HasMaxLength(100);

            this.Property(t => t.Document__)
                .HasMaxLength(8);

            this.Property(t => t.Account__)
                .HasMaxLength(20);

            this.Property(t => t.Account_Description)
                .HasMaxLength(30);

            this.Property(t => t.Currency)
                .HasMaxLength(5);

            this.Property(t => t.Voucher)
                .HasMaxLength(6);

            this.Property(t => t.CHECK)
                .HasMaxLength(6);

            this.Property(t => t.invoice_reference)
                .HasMaxLength(6);

            this.Property(t => t.Cost_Center)
                .HasMaxLength(40);

            this.Property(t => t.origin)
                .HasMaxLength(2);

            this.Property(t => t.sumfields)
                .IsRequired()
                .HasMaxLength(68);

            this.Property(t => t.dimfields)
                .IsRequired()
                .HasMaxLength(7);

            // Table & Column Mappings
            this.ToTable("so_ManBatchDet");
            this.Property(t => t.BATCH).HasColumnName("BATCH");
            this.Property(t => t.Transaction_Description).HasColumnName("Transaction_Description");
            this.Property(t => t.Classfication).HasColumnName("Classfication");
            this.Property(t => t.Document__).HasColumnName("Document_#");
            this.Property(t => t.DATE).HasColumnName("DATE");
            this.Property(t => t.Account__).HasColumnName("Account_#");
            this.Property(t => t.Account_Description).HasColumnName("Account_Description");
            this.Property(t => t.Due_Date).HasColumnName("Due_Date");
            this.Property(t => t.Currency).HasColumnName("Currency");
            this.Property(t => t.Debit).HasColumnName("Debit");
            this.Property(t => t.Credit).HasColumnName("Credit");
            this.Property(t => t.debit_base_1).HasColumnName("debit_base_1");
            this.Property(t => t.Credit_base_1).HasColumnName("Credit_base_1");
            this.Property(t => t.Debit_base_2).HasColumnName("Debit_base_2");
            this.Property(t => t.Credit_base_2).HasColumnName("Credit_base_2");
            this.Property(t => t.Voucher).HasColumnName("Voucher");
            this.Property(t => t.CHECK).HasColumnName("CHECK");
            this.Property(t => t.invoice_reference).HasColumnName("invoice_reference");
            this.Property(t => t.Cost_Center).HasColumnName("Cost_Center");
            this.Property(t => t.origin).HasColumnName("origin");
            this.Property(t => t.sumfields).HasColumnName("sumfields");
            this.Property(t => t.dimfields).HasColumnName("dimfields");
        }
    }
}
